package com.k8.rpc.exchange;

import com.k8.common.annotation.SPI;
import com.k8.common.factroy.BeanFactory;
import com.k8.rpc.invoke.invocation.Invocation;
import com.k8.rpc.result.Result;
import com.k8.rpc.url.URL;

import java.util.concurrent.ExecutionException;

/**
 * @Author: k8
 * @CreateTime: 2025-04-07
 * @Version: 1.0
 */
public interface Exchange {
    boolean serverOpened();

    void preConnect(URL subUrl);

    void openServer(URL protocolUrl, BeanFactory beanFactory) throws ExecutionException, InterruptedException;

    Result<?> call(Invocation invocation) throws Throwable;

    void shutDown();
}
